<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
</head>

<body>
    <!--   <input type="text" id="myInput" value="" /> <button id="btn">点击</button>
    <script> -->
    <!--  /* var age = parseInt(prompt("请输入年龄")); if (age > 51) { console.log("大于50"); } if (age
    < 60) { console.log( "小于60"); } */ /* var num=p arseInt(prompt( "请输入")); if (num> 50) { console.log("大于50"); } if (num
        < 60 && num> 50) { console.log("小于60"); } */ /* var score = parseInt(prompt("请输入分数")); if (score== 60) { document.write("及格"); } else { document.write("不及格"); } */ /* /* var num = parseInt(prompt("请输入")); if (num >= 1) { document.write("男"); } else { document.write("其他");
            } */ /* var xy = prompt("请输入"); if (xy == "下雨了") { document.write("带伞"); } else { document.write("不带伞"); } */ /* var num = parseInt(prompt("请输入")); if (num == 1) { document.write("男"); } else { document.write("其他"); } */ /* var day = parseInt(prompt("请输入星期"));
            if (day == 1 || day == 2) { document.write("雨"); } else if (day == 3 || day == 4) { document.write("香"); } else if (day == 5 || day == 6) { document.write("肉"); } else if (day == 7) { document.write("丝"); } */ /* var fs = parseInt(prompt("请输入分数"));
            if (fs
            < 60 && fs>= 0) { document.write("请继续努力"); } else if (fs >= 60 && fs
                <=7 0) { document.write( "不容易，及格啦"); } else if (fs> 70 && fs
                    <=8 0) { document.write( "太棒了，保持良好"); } else if (fs>= 80 && fs
                        <=1 00) { document.write( "大神"); -->
    <!-- <input } */ /* var inputElement=d ocument.getElementById( "myInput"); var btn=d ocument.getElementById( "btn"); btn.onclick=f unction() { var fs=p arseInt(inputElement.value); if (fs
                            < 60 && fs>= 0) { alert("请继续努力"); } else if (fs >= 60 && fs
                            <=7 0) { alert( "不容易，及格啦"); } else if (fs> 70 && fs
                                <=8 0) { alert( "太棒了，保持良好"); } else if (fs>= 80 && fs
                                    <=1 00) { alert( "大神"); } }; */ -->
    <!-- </script> -->
    <input id="num1" />
    <select name="" id="calc">
      <option value="+">+</option>
      <option value="-">-</option>
      <option value="*">*</option>
      <option value="/">/</option>
    </select>
    <input id="num2" />
    <button id="btn">计算</button> 结果：
    <input type="text" name="" id="res" />
    <script>
        var btnEle = document.getElementById("btn");
        var num1Ele = document.getElementById("num1");
        var num2Ele = document.getElementById("num2");
        var resEle = document.getElementById("res");
        var sleEle = document.getElementById("calc");
        btnEle.onclick = function() {
            var num1 = parseInt(num1Ele.value);
            var num2 = parseInt(num2Ele.value);
            var calc = sleEle.value;
            if (calc == "+") {
                var res = num1 + num2;
            } else if (calc == "-") {
                var res = num1 - num2;
            } else if (calc == "*") {
                var res = num1 * num2;
            } else if (calc == "/") {
                var res = num1 / num2;
            }
            console.log(res);
            resEle.value = res;
        };
    </script>
</body>

</html>